<?php
namespace app\admin\controller;

use think\Controller;

class Member extends Controller
{
    public function _initialize()
    {
        $this->assign("url",request()->url());
    }
    public function login()
    {
        $cms=model("cms");
        if(request()->isPost())
        {
            $cms=model("cms");
            $cms=$cms->get(["username"=>input("post.username"),"password"=>input("post.password")]);
            if($cms==null){
                $msg="用户名或者密码不正确";
                $this->assign("msg",$msg);
            }else{
                session("cms",$cms);
                $this->redirect("index/index");
            }
        }
        return view();
    }
    public function logout()
    {
        session("cms",null);
        $this->redirect("member/login");;
    }
}
